package com.shanyutiwen.springbootblogtest.service;

import com.shanyutiwen.springbootblogtest.dao.PostDao;
import com.shanyutiwen.springbootblogtest.model.PostModel;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class PostServiceImpl implements PostService {

    @Resource
    PostDao postDao;

    @Override
    public void savePost(PostModel post) {
        postDao.savePost(post);
    }

    @Override
    public void deletePost(Long id) {
        postDao.deletePost(id);
    }

    @Override
    public PostModel getPostById(Long id) {
        return postDao.getPostById(id);
    }

    @Override
    public void updatePost(PostModel post) {
        postDao.updatePostById(post);
    }

    @Override
    public List<PostModel> getAll() {
        return postDao.getAllPost();
    }

    @Override
    public void deleteAllPost() {
        postDao.deletAllPost();
    }
}
